require 'test_helper'


class MessageTest < ActiveSupport::TestCase
  setup { @client = clients :irc }


  test "should not save message without nick" do
    message = @client.messages.create MESSAGE_PARAMS_MISSING_NICK
    assert_not message.save
  end

  test "should not save message with empty nick" do
    message = @client.messages.create MESSAGE_PARAMS_BLANK_NICK
    assert_not message.save
  end

  test "should not save message without text" do
    message = @client.messages.create MESSAGE_PARAMS_MISSING_TEXT
    assert_not message.save
  end

  test "should not save message with empty text" do
    message = @client.messages.create MESSAGE_PARAMS_BLANK_TEXT
    assert_not message.save
  end

  test "should save message with valid params" do
    message = @client.messages.create MESSAGE_PARAMS_VALID
    assert message.save
  end
end
